|
|
|
|
|
|
|
Figure 5.22.
Adding the CompanyMaster command buttons. |
|
|
|
|
|
|
|
|
First, add the following line of code in the general declaration section of the form. |
|
|
|
|
|
|
|
|
The following code sections should be placed behind each button. You placed identical code behind other examples earlier this week. Begin with Listing 5.48, which shows the code to enter behind the cmdAdd command button. |
|
|
|
|
|
|
|
|
Listing 5.48. Adding data records. |
|
|
|
|
|
|
|
|
Private Sub cmdAdd_Click()
'
Data1.Recordset.AddNew ' add a new record to table
nAddRec = True
'
End Sub |
|
|
|
|
|
|
|
|
Now add the code in Listing 5.49 to the cmdExit button. This code unloads the form when the Exit button is selected. |
|
|
|
|
|
|
|
|
Listing 5.49. Unloading the CompanyMaster form. |
|
|
|
|
|
|
|
|
Sub cmdExit_Click ()
Unload Me ' close myself (better than END)
End Sub |
|
|
|
|
|